<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>后台管理系统</title>
<js href="__PUBLIC__/Js/Jquery/jquery-1.4.4.min.js" />
<link href="../Public/admin/css/golbal.css" rel="stylesheet" type="text/css" />
<link href="../Public/admin/css/notice.css" rel="stylesheet" type="text/css" />
</head>

<body>
<div class="tittle">
<span>广告管理</span>
<a href="{:U('Ad/addad')}">添加广告</a>
</div>
<div class="detab" >
<table cellpadding="0" cellspacing="0" border="0" >
<tbody>
<tr class="thi">
<th width="183">广告标题</th>
<th width="190">广告链接</th>
<th width="302">广告图片</th>
<th width="173">广告状态 </th>
<th width="100">广告排序 </th>
<th width="123">操作</th>
</tr>
<volist id='vo' name='list'>
<tr>
<td>{$vo.adname|msubstr=###,0,8}</td>
<td>{$vo.adurl}</td>
<td><img src="__PUBLIC__/Admin/Ad/m_{$vo.adimg}"></img></td>
<eq name="vo['status']" value="0">
<td class="forbid"><span style="margin-left:10px;">否</span><a href="javascript:void(0);" onclick="enable({$vo.adid});"> </a></td>
<else/>
<td class="start"><span style="margin-left:10px;">是</span><a href="javascript:void(0);" onclick="forbidden({$vo.adid});"> </a></td>
</eq>
<td>{$vo.orders}</td>
<td class="last_bt"><a href="{:U('Ad/edit',array('adid'=>$vo['adid']))}" class="edit"style="margin-left:28px; _margin-left:14px;">编辑</a><a href="{:U('Ad/move',array('adid'=>$vo['adid']))}" class="move"onclick="return confirm('确定要删除吗')">删除</a></td>
</tr>
</volist>
</tbody>
</table>
</div>

<div class="num">

</div>
<div class="clear"></div>
<script type="text/javascript">

//禁用
function forbidden(cateid) {
	cateid = cateid ? cateid : getChecked();
	cateid = cateid.toString();
	if(cateid == '' || !confirm('确定要取消启用？')) return false;
	$.post("{:U('Ad/forbidden')}", {adid:cateid}, function(res){
		if(res == '1') location.href = location.href;
		else alert('禁用失败');
	});
}

//启用
function enable(cateid) {
	cateid = cateid ? cateid : getChecked();
	cateid = cateid.toString();
	$.post("{:U('Ad/enable')}", {adid:cateid}, function(res){
		if(res == '1') location.href = location.href;
		else alert('激活失败');
	});
}
</script>
</body>
</html>
